package com.liqi.display.controller;

import com.liqi.display.common.Constants;
import com.liqi.display.common.Results;
import com.liqi.display.common.SystemCode;
import com.liqi.display.enums.RegionEnum;
import com.liqi.display.service.*;
import com.liqi.display.service.impl.UpProAcceptServiceImpl;
import com.liqi.display.utils.DateUtil;
import com.liqi.display.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    ITblTakeNumberService takeNumberService; //取号

    @Autowired
    ITblOArchiveService oArchiveService; //预约

    @Autowired
    private UpProAcceptServiceImpl upProAcceptService;//办理

    @Autowired
    IUpProEvalService upProEvalService;//满意度

    @Autowired
    private ITblAnnounceNumberService announceNumberService;

    @Autowired
    private ITblHandoutarchiveService iTblHandoutarchiveService;


    /**
     * 获取当月平均等待时长,通过取号时间、叫号时间做计算
     * @return
     */
    @GetMapping("get")
    public Results getList(){
        Results results=new Results();
        try {
            Map<String, Integer> map = takeNumberService.totalOrAndCur();
            results.setData(map);
            results.setCode(SystemCode.SYS_OK.getKey());
            results.setMessage(SystemCode.SYS_OK.getValue());
            return results;
        }catch (Exception e){
            results.setData(null);
            results.setCode(SystemCode.SYS_FAIL.getKey());
            results.setMessage(SystemCode.SYS_FAIL.getValue());
            return results;
        }
    }
}
